package  
{
	/**
	 * ...
	 * @author Kyl
	 */
	public class GameProgress 
	{
		private var levelsDone:Array;
		private var numLevels:int;

		public function GameProgress(numLevels:int) 
		{
			this.numLevels = numLevels;
			levelsDone = new Array(numLevels);
			for ( var i:int = 0; i < numLevels; i++ )
				levelsDone[i] = -1;
		}
		
		public function finishLevel(level:int, inkRemain:int) :void
		{
			if ( level >= levelsDone.length || level < 0)
				return;
				
			levelsDone[level] = inkRemain;
		}
		
		public function isLevelFinished(level:int) : Boolean
		{
			if ( level >= levelsDone.length || level < 0 )
				return false;
				
			if (levelsDone[level] >= 0)
				return true;
				
			return false;
		}
		
		public function getCount(level:int) : int
		{
			if (level < levelsDone.length && level >= 0)
				return levelsDone[level];
			return -1;
		}
		
		public function getFurthestLevel():int
		{
			for (var i:int = 0; i < numLevels; i++) {
				if (!isLevelFinished(i)) {
					return i;
				}
			}
			return numLevels;
		}
		
		
	}

}